/******************************************************************************
* Module: 'moshe'
* Generated on Sun Nov 11 20:27:22 2007
******************************************************************************/
#include "moshe.h"

cconres_t ccon_value3_parse(ccon_value3_t * obj, stream_t * stream)
{
    int count;
    int length;
    length = obj->parent->m_length;
    obj->data = (char*)malloc(length);
    count = stream->read(stream->self, obj->data, length);
    if (count != length) return CCONRES_END_OF_STREAM;
    return CCONRES_OKAY;
}

cconres_t ccon_lines4_parse(ccon_lines4_t * obj, stream_t * stream)
{
    PROPAGATABLE;
    _res = ccon_ubint8_parse(&obj->m_length, stream);
    PROPAGATE;
    obj->m_value.parent = obj;
    _res = ccon_value3_parse(&obj->m_value, stream);
    PROPAGATE;
    return CCONRES_OKAY;
}

cconres_t ccon_lines5_parse(ccon_lines5_t * obj, stream_t * stream)
{
    PROPAGATABLE;
    int i;
    int count;
    count = obj->parent->m_count;
    obj->elements = (ccon_lines4_t*)malloc(count * sizeof(ccon_lines4_t));
    for (i = 0; i < count; i++)
    {
        obj->elements[i].parent = obj;
        _res = ccon_lines4_parse(&obj->elements[i], stream);
        PROPAGATE;
    }
    return CCONRES_OKAY;
}

cconres_t ccon_foo6_parse(ccon_foo6_t * obj, stream_t * stream)
{
    PROPAGATABLE;
    _res = ccon_ubint8_parse(&obj->m_count, stream);
    PROPAGATE;
    obj->m_lines.parent = obj;
    _res = ccon_lines5_parse(&obj->m_lines, stream);
    PROPAGATE;
    return CCONRES_OKAY;
}

